home *** CD-ROM | disk | FTP | other *** search
-
- Program name: SWAP
-
- Written with: Lattice C 3.1 and Cape Assembler
-
- Machine: Standard Amiga 500 with OS1.3, One floppy drive,1 MByte RAM
-
- Author: Kamran Karimi
-
- Source: Included
-
- What it does: tries to bring swapping to Amiga without any special hardware
-
- Program status:The program can be used freely but I retain the Copyright to
- both the source and executable forms of the program.
-
- Directory contents:
- SWAP 52620 bytes
- SWAP.c
- PatchSignaling.s
- SWAP.ReadMe
-
-
- IMPORTANT:
-
- The Swapping portion of this program is not very reliable as its
- functions are not supported by the OS. Do NOT swap out programs with
- valuable data gathered or computations done as you may not be able to swap
- them in again.
-
-
-
-
- Memory management may be considered as one of the weak points of Amiga OS.
- SWAP is written as a trial to provide swapping for Amigas without any special
- hardware. The main intention is to let the user choose a task, swap it to
- disk so that its occupied memory is released, and do other things. Later on,
- he could swap the program back to main memory and let it continue from the
- point it was interrupted. If The Operating System was capable of swapping,
- then it could do the swappings automatically, but now the user should decide
- when to swap out or in. Also if the OS supported these functions, it could
- move memory around and help the swap-in process, but it does not.
-
-
- The program lets the user do other things as well. A list of all tasks in the
- system is shown and the user can select them by clicking on the desired one.
- the name of the selected task and its task structure address is shown.
-
- The actions that can be applied to the selected task depend on the task state
- and the program enables/disables gadgets depending on it. here is a brief
- description of the gadget functions.
-
- Upadate: searches the task lists in the system and displays them. also
- updates the available memory and swap space. the swap space is the space
- available on the volume indicated in the string gadget.
-
- Info: shows the contents of the task structure belonging to the currently
- selected task.
-
- Freeze: puts the task in the EXECBase IntrList so that it is not executed
- any more. It is changed to 'Melt' whenever a frozen task is chosen.
-
- Pri: changes the task priority. the new priority should be given in the
- string gadget.
-
- Kill: removes the task from system but first searches the PortList and
- removes any port belonging to the selected task, with the exception of the
- IDCMP ports.
-
- Swap In: Reads from the file indicated in the string gadget and tries
- to swap the selceted task in. It may not be successful all the times!.
-
- Swap Out: swaps the selected task out and writes it to the file indicated
- by the string gadget. It will be active only when you first click on the
- "Segs" gadget.
-
- Signal: Signals the selected task. The signal mask should be given in the
- string gadget.
-
- Break: Sends break to the selected task if it is ready to accept them.
-
- Segs: Shows the segments in memory belonging to the selected task.
-
- Memory: Displays the free memory list. It is not precise because some memory
- is allocated to display the information themselves!.
-
- W&S: Windows and Screens. Shows the screens and the windows in them.
- windows belonging to a screen are shown below it. One can close them. If a
- screen is selected to close, then all its windows are closed before it.
-
- Find Intruder: In case there are dificulties swapping a program in, this
- gadget can be tried. It searches the tasks and their segments in memory
- to find out if a task has been loaded in a part of memory needed by the
- swapped out program. It can not search memory allocated in any way other than
- program-loading.
-
- Exit: Exits the program after asking for confirmation.
-
- Some of the options require confirmation. If so, a message telling this
- is displayed in the message area. if you want the operation done, click
- on the gadget again. Otherwise, click on any other gadget.
-
-
- How to swap a program out:
-
- Select the task you want to swap. Don't choose vital system tasks as you
- may lock the computer. press the 'Segs' button and a list of the task's
- segments in memory is displayed. If possible, the 'Swap Out' gadget is
- enabled. Write the full path and name of the file you want the swap image to
- be writen to. The default path is 'df0:', add the name of the swap file after
- it or give a new file and path name. Click the 'Swap Out' gadget and wait
- until it is finished.
-
- To swap a program in, select it. The 'Swap In' gadget will become enabled.
- Click on it an then hope that everything goes OK!. If problems occured,
- refer to the hints written some lines below.
-
-
- Internals of swapping routines:
-
- The swapping portion of the program works as follows: the chosen task is
- removed from ready or waiting queue and inserted in the IntrList list in the
- EXECBase structure. Its segments in memory are traversed and an exact copy of
- them is made on the floppy/hard disk, and then the segments are released.task
- state is changed. PutMsg() and Signal() routines are patched so as to prevent
- the system from acting on the swapped tasks, which would lead to a crash.
- Memory allocated by using AllocMem() or other similar functions are not
- freed, also screens and windows belonging to the swapped task remain untact.
-
- when swapping in, the program uses AllocAbs() to gain the original memory
- area back and copy the file image there. If the call is successful, the
- program will be back in memory and may continue execution. But it is quite
- possible that the required memory is occupied!. In this case the swapping will
- fail. If the failer occurred after the allocation of a number of segments,
- then all the previously allocated memory if freed an you can try swapping
- the program in at a later time (perhaps after carrying out a few of the
- suggestions given below).
-
-
- Hints:
-
- The following can be tried in case of difficulties in swapping a program in:
- Make windows on the screens as small as possible and if possible, close
- them. Even typing at the keyboard causes memory allocation. Try the
- 'Find Intruder' option in SWAP. If an intruder is found, quit it and try to
- swap in again. If it does not work, you may have to quit all the tasks started
- after the swapping one by one. Do not quit the SWAP after swapping a program
- as reloading it may cause allocation of memory in parts needed by the swapped
- program. As the Lattice C 3.1 does not have an option to let one place an
- structure in CHIP memory, Allocmem() was used to get mem for the up an down
- arrow pointer images in the SWAP screen. This memory can not be checked by
- 'Find Intruder' option.
-
-
-
-
- Send Bug reports and suggestions to
-
- Kamran Karimi
- 2,HassanAbad
- HaghShenas str.
- Navab str.
- 13599 - Tehran
- Iran
-
-
-
-